﻿using System;

namespace Yaml.Presentation.Tokens {
    public enum TagTokenType { Verbatim, NonSpecific, PrimaryShorthand, SecondaryShorthand, NamedHandle };
    public class TagToken : Token {
        private TagTokenType type;
        private string handle;
        private string suffix;

        public TagToken(Mark start, Mark end, TagTokenType type, string handle, string suffix) : base(start, end) {
            this.type = type;
            this.handle = handle;
            this.suffix = suffix;
        }

        public string Handle {
            get { return this.handle; }
        }
        public string Suffix {
            get { return this.suffix ?? "--NONE--"; }
        }
        public TagTokenType Type {
            get { return this.type; }
        }

        public override String ToString() {
            return "#<" + this.GetType().Name + " type='" + type.ToString().ToLower() + "' handle='" + Default(handle) + "' suffix='" + Default(suffix) + "' start=" + Start.ToString() + " end=" + End.ToString() + ">";
        }

        private string Default(string value) {
            return value ?? "";
        }

    }
}
